package cate.game.role.mall.msg;

import cate.common.annotation.OperationSetter;
import cate.common.table.d.GDOperation;
import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBMall;
import cate.game.role.mall.Mall;
import easy.java.dev.note.NoteField;
import easy.java.practice.errorcode.EcResult;

@ClientMsg(title = "刷新商店 の 请求")
@OperationSetter(value = GDOperation.MALL_REFRESH, sub = "mallId")
public class RefreshMallReq implements MsgInput {
    @NoteField(value = "商店ID")
    public int mallId;

    @NoteField(value = "刷新类型", detail = "0:不刷新, 1:刷新")
    public int refreshType;

    @Override
    public void execute(GameBody game, ClientContext cc) {
        EcResult<Mall> r = cc.getRole().getMall().refreshMall(mallId, refreshType);
        if(!r.ok()){
            game.notice.message(cc.getRole(), r.message);
        }
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBMall.REFRESH_MALL_REQ;
    }
}
